package com.hl.springboot4.schedule;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @ClassName SwaggerConfig
 * @Description TODO
 * @Author libowen
 * @Date 2025年03月06日 15:31
 * @Version 1.0
 */
@Configuration
@EnableOpenApi  // 开启swagger
public class SwaggerConfig {

    @Bean  // 把当前方法的返回值放入到ioc容器中
    public Docket createRestApi(){
        return new Docket(DocumentationType.OAS_30)
               .apiInfo(apiInfo())
               .select()
               .apis(RequestHandlerSelectors.any())
                .paths(PathSelectors.any())
                .build();
    }

    public ApiInfo apiInfo(){
        return new ApiInfoBuilder()
                .title("十方智育项目接口文档")
                .description("项目接口详细信息")
                .contact(new Contact("李博文","http://www.baidu.com","3798727271@qq.com"))
                .version("1.0")
                .build();
    }
}
